import request from '@/utils/request'

/**
 * 查询数据
 * return promise
 */
export const list = searchPage => {
  return request({
    url: '/lost/page',
    method: 'POST',
    data: searchPage
  })
}

/**
 * 新建
 * @param {*} job
 * @returns
 */
export const add = data => {
  return request({
    url: '/lost',
    method: 'POST',
    data
  })
}

/**
 * 新增并发布
 * @param {*} data
 * @returns
 */
export const addAndPublic = data => {
  return request({
    url: '/lost',
    method: 'POST',
    data
  })
}

/**
 * 修改
 * @param {*} job
 * @returns
 */
export const modify = (data, id) => {
  return request({
    url: '/lost/' + id,
    method: 'PUT',
    data
  })
}

/**
 * 删除
 * @param {*} ids
 */
export const deleteByIds = ids => {
  return request.delete('/lost', ids)
}

export const deleteById = id => {
  return request.delete(`/lost/${id}`)
}

/**
 * 使用单引号需要拼接 使用 ` 可以赋值
 * @param {*} id
 * @returns
 */
export const getById = id => {
  return request({
    url: `/lost/${id}`,
    method: 'GET'
  })
}

/**
 * 申请
 * @param {*} data
 * @returns
 */
export const apply = data => {
  return request({
    url: '/lost/apply',
    method: 'POST',
    data
  })
}

/**
 * 审核
 * @param {*} data
 * @returns
 */
export const audit = lostFound => {
  return request({
    url: '/lost',
    method: 'POST',
    data: lostFound
  })
}
